<?php include "../../coresection/connection.php";?>
<?php include "../../coresection/checkSession.php";?>
<?php include "../../coresection/admin-product.php";?>
<?php include "../../coresection/order-list.php";?>
<?php include "detail-list-function.php";?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include '../../modules/head.php'; ?>
</head>

<body>
<?php include '../../modules/topbar.php'; ?>


<div class="setup_area">


    <?php include '../../modules/sidebar-admin.php'; ?>

    <div class="header">
        <h1>菜式库管理</h1>

        <?php include '../../modules/header.php'; ?>

    </div>





 <div class="content_area dishes_box">

<div class="dishes-function">
    <a href="detail-add.php" class="layui-btn" >添加新菜式</a>
</div>






     <div class="layui-form">
     <table class="layui-table">
         <colgroup>

             <col width="350">
             <col>
             <col>
             <col>
             <col>
         </colgroup>
         <thead>
             <th>名称</th>
             <th>价格</th>
             <th>时段</th>
             <th>发布</th>
             <th>操作</th>
         </tr>
         </thead>
         <tbody>


             <?php

             if ($detailnum == 0) {
                 echo "数据添加中";
             }

             ?>


             <?php for ($i = 0; $i < $detailnum; $i++) {
                 ?>
             <tr>

                 <td class="title-name">
                     <a href="detail-edit.php?nid=<?php echo $detail_nid[$i] ?>&sys_part=<? echo $system_part ?>" <? if ($detail_publish[$i] != 1) {
                         echo "class='title-notice'";
                     } ?> ><?php echo $detail_name[$i] ?></a>
                 </td>
                 <td class="price"> <?php echo $detail_price[$i] ?>
                 </td>
                 <td class="at">

                     <?
                     if ($detail_at[$i] == 1) {
                         echo "早餐";
                     } elseif ($detail_at[$i] == 2) {
                         echo "午餐";
                     } else {
                         echo "晚餐";
                     }
                     ?>

                 </td>


                 <td class="publish <? if ($detail_publish[$i] != 1) {
                     echo "title-notice";
                 } ?>"> <? if ($detail_publish[$i] == 1) {
                         echo "是";
                     } else {
                         echo "否";
                     } ?>
                 </td>

                 <td class="list-boxing-function">

                     <a href="detail-delete.php?nid=<?php echo $detail_nid[$i] ?> " class="delete">删除</a>

                     <a href="detail-edit.php?nid=<?php echo $detail_nid[$i] ?>&sys_part=<? echo $system_part ?>&nowpageid=<? echo $_REQUEST['nowpageid'] ?>&sortby=<? echo $_REQUEST['sortby'] ?>&term_nid=<? echo $trans_nid ?>"
                        class="modify">修改</a>

                 </td>

             </tr>
                 <?php

             }
             ?>






         </tbody>
     </table>
 </div>




<div class="list-box-function" <? if ($detailnum == 0) {
    echo "style" . "='display:none'";
} ?> >
    <div class="page-guide">

        <?php
        if ($nowpageid == 1) {
            ?>
            <!--现在页数在第一页的时候-->
            <span>首页</span>
            <span>前一页</span>
            <!--现在页数非第一页的时候-->
        <?php
        } else {
            ?>
            <!--现在页数非第一页的时候-->
            <a href="detail-list.php?sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">首页</a>
            <a href="detail-list.php?nowpageid=<?php echo $prepage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">前一页</a>
            <!--现在页数非第一页的时候-->
        <?php
        }
        ?>


        <!--开始列印出所有页码-->

        <?php
        $ii = 1;
        $iii = 1;

        while ($ii <= $page_count) {
            //首先判断是不是当前页

            if ($ii == $nowpageid) {
                echo "<span>" . $ii . "</span>";
            } else if ((($ii + 5) < $nowpageid) || (($ii - 5) > $nowpageid)) {
            } else {
                echo "<a href='";
                echo "detail-list.php?nowpageid=";
                echo $iii;
                echo "&sortby=";
                echo $sort_by;
                echo "&nid=";
                echo $trans_nid;
                echo "&sys_part=";
                echo $system_part;
                echo "'>";
                echo $iii;
                echo "</a>";
            }

            $ii++;
            $iii++;
        }
        ?>

        <!--列印出所有页码 结束-->


        <?php
        if ($nowpageid == $page_count) {
            ?>
            <!--现在页数在第一页的时候-->
            <span>后一页</span>
            <span>末页</span>
            <!--现在页数非第一页的时候-->
        <?php
        } else {
            ?>
            <!--现在页数非第一页的时候-->
            <a href="detail-list.php?nowpageid=<?php echo $nextpage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">后一页</a>
            <a href="detail-list.php?nowpageid=<?php echo $lastpage; ?>&sortby=<?php echo $sort_by; ?>&nid=<?php echo $trans_nid ?>&sys_part=<? echo $system_part ?>">末页</a>
            <!--现在页数非第一页的时候-->
        <?php
        }
        ?>


    </div>
    <!--翻页代码结束-->
</div>
</div>


<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>

<?php include '../../modules/footer.php'; ?>
</body>
</html>
